package com.example.study.mapper;

import com.example.study.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author 宋伟宁
 * @Date 2023/10/8
 * @Version 1.0
 **/
public interface UserMapper {

    @Select("select * from t_user")
     List<User> findAll();

    @Delete("delete from t_user where uid=#{uid}")
    int del(int uid);

    @Insert("insert into t_user(username,password,realname,sex,birthday,status) values(#{username},#{password},#{realname},#{sex},#{birthday},0) ")
    int add(User user);

    @Update("update t_user set username=#{username},password=#{password},realname=#{realname},sex=#{sex},birthday=#{birthday} where uid=#{uid}")
    int update(User user);

    @Select("select * from t_user where uid=#{uid}")
    User findById(int uid);
}
